function confirmAssignment()
{
	suggestTruck();
	var assign = confirm("Click ok to confirm truck assignment.");
	if(assign)
	{
		suggestTruck();
		assignTruck();
	}
}

xmlhttp_trucker = null;
function assignTruck()
{
xmlhttp_trucker=GetXmlHttpObject();
if (xmlhttp_trucker==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var trip_id = document.getElementById('hf_assign_trip_id').value;
var truck_id = document.getElementById('hf_truck_id').value;
var sms_to = document.getElementById('txt_sms_to').value;
var url="ajax_assignment.php";
url=url+"?trip="+trip_id;
url=url+"&truck="+truck_id;
url=url+"&sms_to="+sms_to;
xmlhttp_trucker.onreadystatechange=function (){
if (xmlhttp_trucker.readyState==4)
  {
	if(xmlhttp_trucker.responseText=="1")
	{
		redirectFrame("bodyFrame","queue_list.php");
		alert("Successfully assigned trip!");
		closePopDiv();
	}
  }
};
xmlhttp_trucker.open("GET",url,true);
xmlhttp_trucker.send(null);
}


function assignTruckv2()
{
xmlhttp_trucker=GetXmlHttpObject();
if (xmlhttp_trucker==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var trip_id = document.getElementById('hf_assign_trip_id').value;
var trucker_id = document.getElementById('sel_trucker').value;
var truck_id = document.getElementById('sel_truck').value;
var url="ajax_assignment.php";
url=url+"?trip="+trip_id;
url=url+"&trucker="+trucker_id;
url=url+"&truck="+truck_id;
xmlhttp_trucker.onreadystatechange=function (){
if (xmlhttp_trucker.readyState==4)
  {
	if(xmlhttp_trucker.responseText=="1")
	{
		redirectFrame("bodyFrame","queue_list.php");
		alert("Successfully assigned trip!");
		closePopDiv();
	}
  }
};
xmlhttp_trucker.open("GET",url,true);
xmlhttp_trucker.send(null);
}